package com.huoniu.order.fegin;

import com.huoniu.order.entity.User;
import com.netflix.loadbalancer.RoundRobinRule;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @类 名： UserFeign <br/>
 * @描 述： <br/>
 * @日 期： 2020/9/17 11:55<br/>
 * @作 者： 侯建军<br/>
 * @版 本： 1.0.0
 * @since JDK 1.8
 */
@Component
@RibbonClient(configuration = {RoundRobinRule.class})
@FeignClient(value = "USER-SERVICE",path = "/user")
public interface UserFeign {
    /**
     * 服务提供者方法名称一致
     * @return
     */
//    @GetMapping("/user/getUserName")
//    String getUserName(@RequestParam("username") String username);
//    @GetMapping("/user/getUserName")
//    String getUserName(@RequestParam("username") String username,@RequestParam("password") String password); @GetMapping("/user/getUserName")

    @GetMapping("/getUserName")
    String getUserName(@RequestParam Map<String, Object> params);

    @PostMapping(value = "/getUpdateUser",consumes = MediaType.APPLICATION_JSON_VALUE)
    User getUpdateUser(User user);

    @PostMapping("/getEnum")
    User getEnumTest();
}
